package top.lishuoboy.boot92.datetime.serializable.domain;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.*;
import java.util.Calendar;
import java.util.Date;

/// @author lishuoboy
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@SuperBuilder
public class DateTimeVo {
    /// 1.旧版-日期时间毫秒-含时区
    @ApiModelProperty(position = 110, value = "旧版-日期时间毫秒-含时区")
    private Date date;

    @ApiModelProperty(position = 120, value = "旧版-日期时间毫秒-含时区")
    private Calendar calendar;


    /// 2.1.新版-日期时间纳秒-含时区
    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
    @ApiModelProperty(position = 211, value = "新版-日期时间纳秒-含时区")
    private ZonedDateTime zonedDateTime;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
    @ApiModelProperty(position = 212, value = "新版-日期时间纳秒-含时区")
    private Instant instant;

    /// 2.2.新版-本地日期时间（不含时区）
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @ApiModelProperty(position = 220, value = "新版-本地日期时间纳秒-不含时区")
    private LocalDateTime localDateTime;

    @ApiModelProperty(position = 221, value = "新版-本地日期-不含时区")
    private LocalDate localDate;

    @JsonFormat(pattern = DatePattern.NORM_TIME_PATTERN)
    @ApiModelProperty(position = 222, value = "新版-本地时间纳秒-不含时区")
    private LocalTime localTime;

    /// 2.3.新版-时间段
    @ApiModelProperty(position = 231, value = "新版-时间段-年月日。最大单位为“年”。P1Y1M1D")
    private Period period;

    @ApiModelProperty(position = 232, value = "新版-时间段-时分秒。最大单位为“时”。1H1M1.000000001S")
    private Duration duration;

    /// 2.4.新版-其它
    @ApiModelProperty(position = 241)
    private YearMonth yearMonth;

    @ApiModelProperty(position = 242)
    private MonthDay monthDay;

    @ApiModelProperty(position = 243)
    private Year year;

    @ApiModelProperty(position = 244)
    private Month month;
}
